#!/bin/bash

# cplus is part of code.google.com/p/camtools, copyright 2006-2007 Camille Huot
# and is licensed under http://www.gnu.org/copyleft/gpl.html

NOW=$(date +%y-%m-%d)

trap exit 2 9

if [ $# -lt 1 ]; then
	DAYS=1
else
	DAYS="$*"
fi

for DAY in $DAYS; do
	DATE=$(date --date="$NOW -$DAY days" +%y%m%d)

	if [ "x$E" = "x" ]; then
		E="zapping guignols groland"
	fi

	for PROG in $E; do
		for PART in a b; do
			URL="http://193.201.103.108:80/canalplus/${PROG}_${DATE}_${PART}.wmv?MSWMExt=.asf"
			#if curl -si "$URL" | head -n 1 | grep -q OK; then
				mplayer "$URL"
				sleep 1
			#fi
		done
	done
done
exit
http://vod-flash.canalplus.fr/ZAPPING_EMISSION_070910_CAN_1867_video_H.flv
http://vod-flash.canalplus.fr/LE_MEILLEUR_DU_HIER_EMISSION_070908_CAN_1666_extrait_L.flv
http://vod-flash.canalplus.fr/GROLAND_EMISSION_070908_CAN_1728_video_H.flv
http://vod-flash.canalplus.fr/LES_GUIGNOLS_EMISSION_070910_CAN_1864_video_H.flv
http://vod-flash.canalplus.fr/PEPITES_SUR_LE_NET_EMISSION_070906_CAN_1556_video_H.flv
http://vod-flash.canalplus.fr/LA_BOITE_A_QUESTIONS_EMISSION_070907_CAN_1642_video_H.flv
http://vod-flash.canalplus.fr/SAV_EMISSION_070910_CAN_1858_video_H.flv
/SAV_EMISSION_070907_CAN_1638_video_H.flv
/SAV_EMISSION_070906_CAN_1575_video_H.flv
/SAV_EMISSION_070905_CAN_1491_video_H.flv


# pour avoir le XML qui contient l'URL :
curl -d video%5Fid=49581 http://www.canalplus.fr/flash/xml/module/embed-video-player/embed-video-player.php
